montecarlo
Class MonteCarloTask

java.lang.Object
  extended by montecarlo.MonteCarloTask
All Implemented Interfaces:
java.io.Serializable, java.util.concurrent.Callable<java.util.ArrayList<Jama.Matrix>>, mcmcFunction, Uncmin_methods

public class MonteCarloTask
extends java.lang.Object
implements java.util.concurrent.Callable<java.util.ArrayList<Jama.Matrix>>, Uncmin_methods, mcmcFunction, java.io.Serializable

Task for evaluating a run of the estimator on a single set of fake data.

See Also:
Serialized Form

Field Summary
static double[] TRUE_PARAMETERS
          Vector of true parameters.
 
Constructor Summary
MonteCarloTask(int numGames, int numImportanceGames, int numMCMCDraws)
          Constructor for Monte Carlo Task.
 
Method Summary
 java.util.ArrayList<Jama.Matrix> call()
          This method is called by an ExecutorService, and is where the computational logic is contained.
 double f_to_minimize(double[] x)
          Objective function to minimize.
 void gradient(double[] x, double[] g)
          Gradient, left empty since we just use numerical equivalents.
 void hessian(double[] x, double[][] h)
          Hessian, left empty since we just use numerical equivalents.
 double objectiveFunction(double[] x)
          Method passed to LTE minimizer.
 double pi(double[] x)
          Returns the probability of accepting a draw from the proposal density.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRUE_PARAMETERS

public static double[] TRUE_PARAMETERS
Vector of true parameters.

Constructor Detail

MonteCarloTask

public MonteCarloTask(int numGames,
                      int numImportanceGames,
                      int numMCMCDraws)
Constructor for Monte Carlo Task.

Parameters:
numGames - Number of observations to use in this Monte Carlo experiment.
numImportanceGames - Number of importance games to use in this Monte Carlo experiment.
numMCMCDraws - Number of MCMC draws to use the LTE estimator of Chernozhukov and Hong (2003).
Method Detail

call

public java.util.ArrayList<Jama.Matrix> call()
                                      throws java.lang.Exception
This method is called by an ExecutorService, and is where the computational logic is contained. This method initializes the data set and importance games, and then, depending on the options selected by the user, uses a combination of Newton-based methods and the LTE method of Chernozhukov and Hong (2003) to optimize the resulting econometric problem. The method contains an option for using a two-stage GMM estimator, where the second stage uses an optimal weighting matrix computed from a first-stage GMM estimator using an identity weighting matrix.

Specified by:
call in interface java.util.concurrent.Callable<java.util.ArrayList<Jama.Matrix>>
Returns:
Returns an ArrayList with the various Matrix outputs from the optimization. See below for a description of the matrices.
Throws:
java.lang.Exception

f_to_minimize

public double f_to_minimize(double[] x)
Objective function to minimize.

Specified by:
f_to_minimize in interface Uncmin_methods
Parameters:
x - Vector of unknown parameters.
Returns:
Returns weighted GMM objective function value.

gradient

public void gradient(double[] x,
                     double[] g)
Gradient, left empty since we just use numerical equivalents.

Specified by:
gradient in interface Uncmin_methods
Parameters:
x - Vector of unknown parameters
g - Vector containing gradient

hessian

public void hessian(double[] x,
                    double[][] h)
Hessian, left empty since we just use numerical equivalents.

Specified by:
hessian in interface Uncmin_methods
Parameters:
x - Vector of unknown parameters
h - Array containing Hessian

objectiveFunction

public double objectiveFunction(double[] x)
Method passed to LTE minimizer. Transforms the objective function above to chi-squared form.

Specified by:
objectiveFunction in interface mcmcFunction
Parameters:
x - Vector of unknown parameters.
Returns:
Objective function normalized for use in the LTE procedure.

pi

public double pi(double[] x)
Returns the probability of accepting a draw from the proposal density. Always equal to one in this setting, in general can be used to rule out parts of the parameter space.

Specified by:
pi in interface mcmcFunction
Parameters:
x - Vector of proposed parameters.
Returns:
Probability of acceptance.